package com.miao.im.common;

import lombok.Data;

/**
 * @Author: miaoguoxin
 * @Date: 2019/7/20 20:17
 * @Description:
 */
@Data
public class ApiResult<T> {
    private int code;
    private String message;
    private T data;

    public ApiResult() {
    }


    public ApiResult(int code, String message) {
        this.code = code;
        this.message = message;
    }


    public ApiResult(int code, String msg, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> ApiResult<T> ok(T data) {
        return new ApiResult<>(BizCode.OK,"success", data);
    }

    public static <T> ApiResult<T> err(int code, String msg) {
        return new ApiResult<>(code, msg);
    }
}
